package spring.data.redis.demo2;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MyTest {

	ApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");
	Dao dao = context.getBean(Dao.class);
	
	@Test
	public void save(){
		
		Student student = dao.get("1");
		System.out.println(student);
		
		student = new Student("1", "1", 10);
		dao.save(student);
		
		student = dao.get("1");
		System.out.println(student);
	}
	
	@Test
	public void update(){
		
		Student student = dao.get("1");
		System.out.println(student);
		
		student = new Student("1", "1", 10);
		dao.update(student);
		
		student = dao.get("1");
		System.out.println(student);
	}
	
	@Test
	public void get(){
		
		Student Student = dao.get("1");
		System.out.println(Student);
	}
	
	@Test
	public void remove(){
		
		dao.remove("1");
	}
}
